package org.example.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.tomcat.util.http.fileupload.servlet.ServletRequestContext;
import org.example.dto.Doctor;
import org.example.service.DoctorService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.example.rvo.ResultVO;

import javax.annotation.Resource;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
public class DoctorController {

    @Resource
    private DoctorService doctorService;

    @GetMapping("/queryDoctor")
    public ResultVO queryDoctor(String id) throws JsonProcessingException {

        Doctor doctor=  doctorService.queryDoctor(id);
        if(doctor != null) {
            return ResultVO.success("200", "查询成功", doctor);
        }else{
            return ResultVO.failure("500","查询失败");
        }
    }

}
